package com.example.demo.entity;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @program:IntelliJ IDEA
 * @Description:店铺
 * @author:Mr.CheCheHuiBujianO
 * @data: 2023/3/9 19:19
 */
public class Store {
 


    public List<Staff> staffList;//初始化员工

    private int[] expertPassengerFlow; //预期客流模型
    private int DateNow; // 当前星期几
    public  int[] expertNeedStuff;//需要多少个员工


    public Store() {
        staffList = new ArrayList<>();
    }
    
    /**
     *@Description: 添加员工
     *@Param: [staff]
     *@return:void
     *@Author: Mr.Lin
     *@Date: 2023/3/15 15:53
     */
    public void addStaff(Staff staff){
        staffList.add(staff);
    }

    /**
     *@Description: 初始化客流量模型
     *@Param: [customerDate, DateNow]
     *@return:void
     *@Author: Mr.Lin
     *@Date: 2023/3/15 1:00
     */
    private void setExpertPassengerFlow(int[] customerDate,int DateNow){
        expertNeedStuff = new int[26];
        if (DateNow == 6||DateNow == 7){
            for (int i = 2; i < 26; i++) {
                expertNeedStuff[i] = customerDate[i-2];
            }
        }else {
            for (int i = 0; i < 24; i++) {
                expertNeedStuff[i] = customerDate[i];
            }
        }
        
    }
    

    /**
     *@Description: 根据预期客流生成预期员工列表
     *              判断工作日和周末
     *              加入约束规则 至少有一个人值班
     *              使用前提 需要进行对预期客流量进行赋值 然后将数据传入expertPassengerFlow 且需要指定星期几
     *@Param: [expertPassengerFlow, DateNow]
     *@return:int[]
     *@Author: Mr.Lin
     *@Date: 2023/3/10 0:44
     */
    public int[] generateExpertNeedStuffList(int[] expertPassengerFlow, int DateNow){
        expertNeedStuff = new int[26];
        if (DateNow == 6 || DateNow == 7) {
            for (int i = 2; i < expertPassengerFlow.length; i++) {
                expertNeedStuff[i] = (int) Math.ceil(expertPassengerFlow[i] / Rule.GENERATE_EXPERT_NEED_STUFF_PARA);
                expertNeedStuff[i] = expertNeedStuff[i] == 0 ? Rule.AT_LEAST_ON_BY_DUTY : expertNeedStuff[i];
            }
        }else {
            for (int i = 0; i < expertPassengerFlow.length; i++) {
                expertNeedStuff[i] = (int) Math.ceil(expertPassengerFlow[i] / Rule.GENERATE_EXPERT_NEED_STUFF_PARA);
                expertNeedStuff[i] = expertNeedStuff[i] == 0 ? Rule.AT_LEAST_ON_BY_DUTY : expertNeedStuff[i];
            }
        }
        return expertNeedStuff;
    }



}
